' Amortization Scheduler ' by David Czaya ' Version 1 June 1986 ' This program has been placed in the public domain by ' its author. Any non-commercial, not-for-profit use is a-ok. ' Modifications are permitted but please leave the first two ' lines alone, please. ' Dependents ClR$ = CHR$(12) PrinterPort$ = "PAR:" SOP$ = CHR$(27)+CHR$(78)+CHR$(16) ESOP$ = CHR$(27)+CHR$(79) Scrn = 2 Prin = 1 ' MakeAMenu GOSUB Menus ' Intro WINDOW 2,"Amortization Scheduler",(0,0)-(631,186),8 PRINT ClR$ PRINT SPC(24);"Amortization Scheduler" PRINT :PRINT SPC(30);"by -DAVE-" FOR x = 1 TO 5000:NEXT GetData: PRINT ClR$:PRINT " Name |";:LOCATE 2,9 GOSUB Waiting LINE INPUT;Nam$ Nam$ = FirstLetter$+Nam$ PRINT ClR$:LOCATE 2,2:PRINT UCASE$(Nam$) INPUT " Principle ", Principle LOCATE 3,13:PRINT USING "$$#####,.##";Principle INPUT " Interest ", Interest LOCATE 4,1:PRINT STR$(Interest);"% Annual Percentage Rate" INPUT " Term (yrs.) ", Term LOCATE 5,1:PRINT STR$(Term);" year term ";Term*12;" scheduled payments" PRINT:PRINT " Is this information correct? "; a$ = UCASE$(INPUT$(1)) IF LEFT$(a$,1) <> "Y" THEN GetData Conversions: CompInt = (Interest/100)/12 CompTerm = Term * 12 PBal = Principle Nlength = LEN(Nam$) ' Formula PMT = PBal / ((1-(1+CompInt)^-CompTerm)/(CompInt)) PRINT ClR$ OutData: IF SaveFile = 1 THEN OPEN FileName$+".SCH" FOR OUTPUT AS 1 GOTO header END IF IF TogglePrinter = 1 THEN OPEN PrinterPort$ FOR OUTPUT AS 1 PRINT #1,SOP$; ELSE OPEN "scrn:" FOR OUTPUT AS 1 END IF header: PRINT #1,UCASE$(Nam$);SPC(50-Nlength); PRINT #1,USING"Principle $$#####,.##";Principle FOR x = 1 TO Nlength PRINT #1,"*"; NEXT PRINT #1,SPC(50-Nlength);"Interest =";STR$(Interest);"% A.P.R." PRINT #1,SPC(50);"Term = ";STR$(Term);" year"; IF Term <> 1 THEN PRINT #1,"s" ELSE PRINT #1,"" END IF PRINT #1,SPC(50); PRINT #1,USING"Payment = $$#####,.##";PMT PRINT #1,"" PRINT #1,"Pymt "; PRINT #1,"Present Accrued Accrued" PRINT #1," No. Principle Interest "; PRINT #1,"Balance Principle Interest" PRINT #1,"" ' CalcData WHILE PMTNO < CompTerm NewInt = PBal * CompInt PPrin = PMT - NewInt:IF PPrin > PBal THEN PPrin = PBal PBal = PBal - PPrin APrin = APrin + PPrin AInt = AInt + NewInt PMTNO = PMTNO + 1 PRINT #1,USING "### ";PMTNO; PRINT #1,USING "$$#####,.## ";PPrin; PRINT #1,USING "$$#####,.## ";NewInt; PRINT #1,USING "$$#####,.## ";PBal; PRINT #1,USING "$$#####,.## ";APrin; PRINT #1,USING "$$#####,.##";AInt WEND PRINT #1,"" PRINT #1,USING "Initial Payment =$$#####,.##";PMT PRINT #1,USING "Final Payment = $$#####,.##";PPrin+NewInt IF TogglePrinter = 1 AND SaveFile = 0 THEN PRINT #1,ClR$+ESOP$ IF SaveFile = 1 THEN CLOSE #1 SaveFile = 0 PMTNO = 0 KILL FileName$+".SCH.INFO" GOTO Conversions END IF Four: Bye: CLOSE #1 PRINT:PRINT PRINT "Press any key to end... "; a$ = INPUT$(1) WINDOW CLOSE 2 MENU RESET END Menus: MENU 2,0,0,"" MENU 3,0,0,"" MENU 4,0,0,"" MENU 1,0,1," Output " MENU 1,1,Scrn," Screen " MENU 1,2,Prin," Printer " MENU 1,3,1," Save " MENU 1,4,1," Quit " MENU ON ON MENU GOSUB Trap RETURN Trap: MenuItem = MENU(1) ON MenuItem GOSUB One,Two,Three,Four GOSUB Menus RETURN One: Two: IF MenuItem <> Scrn THEN RETURN SWAP Scrn,Prin TogglePrinter = MenuItem -1 RETURN Three: WINDOW 3,"",(150,15)-(500,60),26 PRINT SPC(12)+"Enter path/filename" LOCATE 5,13:PRINT "[RETURN] to Cancel"; LOCATE 3,4:LINE INPUT;FileName$ WINDOW CLOSE 3 IF FileName$ = "" THEN RETURN ELSE SaveFile = 1 END IF RETURN Waiting: FirstLetter$ = INKEY$ IF FirstLetter$ = "" THEN Waiting IF FirstLetter$ = CHR$(13) THEN GOTO GetData PRINT FirstLetter$; RETURN